/*
 * @Author: Hugh Xie
 * @Date: 2022-05-28 19:51:37
 * @LastEditors: Hugh Xie
 * @LastEditTime: 2022-05-28 19:51:37
 * @FilePath: \frontend\src\utils\index.js
 */
import path from 'path-browserify'




export function isExternalLink(path) {
  return /^(https?:|mailto:|tel:)/.test(path)
}

export function resolveRoutePath(basePath, routePath) {
  if (isExternalLink(routePath)) {
      return routePath
  }
  if (isExternalLink(basePath)) {
      return basePath
  }
  return basePath ? path.resolve(basePath, routePath) : routePath
}